home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Sample Code / Devices / AsyncDriverSample 1.0b4 / AsyncDriverCommon.p next >
Encoding:
Text File  |  1997-03-07  |  2.9 KB  |  117 lines  |  [TEXT/CWIE]

  1. unit AsyncDriverCommon;
  2.  
  3. (*
  4.     File:        AsyncDriverCommon.p
  5.  
  6.     Contains:    Declarations common to the driver and the DropMounter utility.
  7.  
  8.     Written by:    Quinn "The Eskimo!"
  9.  
  10.     Copyright:    © 1996 by Apple Computer, Inc., all rights reserved.
  11.  
  12.     Change History (most recent first):
  13.  
  14.     You may incorporate this sample code into your applications without
  15.     restriction, though the sample code has been provided "AS IS" and the
  16.     responsibility for its operation is 100% yours.  However, what you are
  17.     not permitted to do is to redistribute the source as "DSC Sample Code"
  18.     after having made changes. If you're going to re-distribute the source,
  19.     we require that you make it clear in the source that the code was
  20.     descended from Apple Sample Code, but that you've made changes.
  21. *)
  22.  
  23. interface
  24.  
  25.     uses
  26.         Types,
  27.         OSUtils,
  28.         Files;
  29.  
  30. {$PUSH}
  31. {$ALIGN MAC68K}
  32.  
  33.     (* This is the magic control code that DropMounter sends to
  34.         the device driver in response to a disk image being
  35.         drop on to the application.
  36.        Note that this choice is not accidental.  By setting the
  37.         DriverGestalt bit in our dctlFlags, we're saying that
  38.         we won't use any csCodes below 128 for our private
  39.         functions.
  40.     *)
  41.     
  42.     const
  43.         kMountImageControlCode = 128;
  44.     
  45.     (* This is the format of the param block used for the
  46.         above control code.
  47.     *)
  48.     
  49.     type
  50.         MountParamBlock =
  51.             record
  52.                 qLink: QElemPtr;
  53.                 qType: integer;
  54.                 ioTrap: integer;
  55.                 ioCmdAddr: Ptr;
  56.                 ioCompletion: ProcPtr;
  57.                 ioResult: OSErr;
  58.                 ioNamePtr: StringPtr;
  59.                 ioVRefNum: integer;
  60.                 ioCRefNum: integer;
  61.                 csCode: integer;
  62.                 csParamFileToMount: FSSpecPtr;
  63.             end;
  64.         MountParamBlockPtr = ^MountParamBlock;
  65.  
  66.     (* This is the magic control code that DropMounter sends to
  67.         the device driver immediately after opening it.  It contains
  68.         the information that the device driver would otherwise
  69.         have to get using the Resource Manager.  I wanted to keep this
  70.         out of my device driver because:
  71.         
  72.         1.    Device drivers should not access the toolbox -- While it's
  73.             impossible to write a traditional device driver without using Toolbox
  74.             calls, it's still a good idea to keep them off the Toolbox as much
  75.             as possible.
  76.              
  77.         2.    Minimises the driver code size.
  78.     *)
  79.  
  80.     const
  81.         kSecondaryInitControlCode = 129;
  82.     
  83.     (* This is the format of the param block used for the
  84.         above control code.
  85.     *)
  86.     
  87.     type
  88.         IconType = packed array[0..255] of Byte;
  89.         IconTypePtr = ^IconType;
  90.     
  91.     type
  92.         SecondaryInitParamBlock =
  93.             record
  94.                 qLink: QElemPtr;
  95.                 qType: integer;
  96.                 ioTrap: integer;
  97.                 ioCmdAddr: Ptr;
  98.                 ioCompletion: ProcPtr;
  99.                 ioResult: OSErr;
  100.                 ioNamePtr: StringPtr;
  101.                 ioVRefNum: integer;
  102.                 ioCRefNum: integer;
  103.                 csCode: integer;
  104.                 csParamVersion : NumVersion;
  105.                 csParamMediaIcon : IconType;
  106.                 csParamMediaDescription : Str255;
  107.                 csParamPhysicalIcon : IconType;
  108.                 csParamPhysicalDescription : Str255;
  109.             end;
  110.         SecondaryInitParamBlockPtr = ^SecondaryInitParamBlock;
  111.  
  112. {$ALIGN RESET}
  113. {$POP}
  114.  
  115. implementation
  116.  
  117. end. (* AsyncDriverCommon *)